package com.yc.bigdata.kafka.service;

import com.yc.bigdata.common.dto.DemoMsg;
import com.yc.bigdata.kafka.bind.KafkaStreamBinding;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;


@Service
public class TestProduceService {

    @Autowired
    private KafkaStreamBinding kafkaStreamBinding;

    public void sendMessage(DemoMsg demoMsg) {
        MessageBuilder messageBuilder = MessageBuilder.withPayload(demoMsg);
      /*  messageBuilder.setHeader(MessageHeaders.CONTENT_TYPE, MimeTypeUtils.APPLICATION_JSON);*/
        kafkaStreamBinding.outTest().send(messageBuilder.build());
    }
}
